<template>
  <div>
    <div class="outer">
        <h1>List组件</h1>
        <button @click="sendDataToParent">向父组件传数据</button>
    </div>
  </div>
</template>

<script>
export default {
    name:'List',
    data(){
        return {
            List:[
                {name:"xiaowang",age:18},
                {name:'xiaoming',age:19},
                {name:'xiaoli',age:20}
            ]
        }
    },
    methods:{
        sendDataToParent(){
            //this.$emit()触发当前实例上的自定义事件，附加参数传给监听器回调
            this.$emit('atguigu',this.List)
        }
    }
}
</script>

<style>
.outer{
    height: 200px;
    margin: 30px;
    background: pink;
}
</style>